﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Quartz;
using Quartz.Impl.Triggers;
using Quartz.Impl.Calendar;
using Quartz.Spi;

namespace WeChartWorkRobot.Service.Jobs
{
    public class FixTimeTrigger : TriggerBase
    {
        private readonly DateTime _dateTime;

        public FixTimeTrigger(DateTime dateTime)
        {
            _dateTime = dateTime;
        }

        protected internal override ITrigger GetQuartzTrigger()
        {
                return TriggerBuilder.Create()
                            .StartAt(_dateTime)
                            .WithSimpleSchedule(x => x.WithRepeatCount(0))
                            .Build();
        }

    }


    //class MultiFixTimeTriggerBuild : ScheduleBuilder<SimpleTriggerImpl>
    //{
    //    public override IMutableTrigger Build()
    //    {
            
    //    }
    //}
    //class MultiFixTimerTrigger : AbstractTrigger
    //{
    //    public override DateTimeOffset? FinalFireTimeUtc => throw new NotImplementedException();

    //    public override bool HasMillisecondPrecision => false;

    //    public override DateTimeOffset? ComputeFirstFireTimeUtc(ICalendar cal)
    //    {
    //        throw new NotImplementedException();
    //    }

    //    public override DateTimeOffset? GetFireTimeAfter(DateTimeOffset? afterTime)
    //    {
    //        throw new NotImplementedException();
    //    }

    //    public override bool GetMayFireAgain()
    //    {
    //        throw new NotImplementedException();
    //    }

    //    public override DateTimeOffset? GetNextFireTimeUtc()
    //    {
    //        throw new NotImplementedException();
    //    }

    //    public override DateTimeOffset? GetPreviousFireTimeUtc()
    //    {
    //        throw new NotImplementedException();
    //    }

    //    public override IScheduleBuilder GetScheduleBuilder()
    //    {
    //        throw new NotImplementedException();
    //    }

    //    public override void SetNextFireTimeUtc(DateTimeOffset? nextFireTime)
    //    {
    //        throw new NotImplementedException();
    //    }

    //    public override void SetPreviousFireTimeUtc(DateTimeOffset? previousFireTime)
    //    {
    //        throw new NotImplementedException();
    //    }

    //    public override void Triggered(ICalendar cal)
    //    {
    //        throw new NotImplementedException();
    //    }

    //    public override void UpdateAfterMisfire(ICalendar cal)
    //    {
    //        throw new NotImplementedException();
    //    }

    //    public override void UpdateWithNewCalendar(ICalendar cal, TimeSpan misfireThreshold)
    //    {
    //        throw new NotImplementedException();
    //    }

    //    protected override bool ValidateMisfireInstruction(int misfireInstruction)
    //    {
    //        throw new NotImplementedException();
    //    }
    //}
}
